package org.iwidget.model.javascript;
import org.iwidget.desktop.model.ElementTextArea;
import org.iwidget.desktop.model.WidgetElement;
import org.mozilla.javascript.*;
/**
 *
 * @author Muhammad Hakim A
 */


public class TextAreaElementJS extends ScriptableObject
{

    public String getClassName()
    {
        if(elementData != null)
            return elementData.getName();
        else
            return "TextArea";
    }

    public TextAreaElementJS()
    {
        elementData = new ElementTextArea();
        elementData.setName("TextArea");
    }

    public TextAreaElementJS(WidgetElement widget)
    {
        elementData = new ElementTextArea();
        elementData.setName("TextArea");
        elementData.widget = widget;
    }

    public TextAreaElementJS(WidgetElement widget, String name)
    {
        elementData = new ElementTextArea();
        elementData.setName("TextArea");
        elementData.widget = widget;
        setDefaults();
    }

    public ElementTextArea getElementData()
    {
        return elementData;
    }

    public void setElementData(ElementTextArea d)
    {
        elementData = d;
    }

    private void setDefaults()
    {
        try
        {
            defineProperty("alignment", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("bgColor", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("bgOpacity", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("color", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("cursor", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("data", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("editable", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("font", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("height", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("hScrollbar", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("name", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("onKeyDown", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("onKeyPress", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("onKeyUp", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("onMouseEnter", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("onMouseExit", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("onMouseUp", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("onMouseDown", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("opacity", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("owner", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("size", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("style", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("tooltip", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("visible", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("vScrollbar", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("width", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("x", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
            defineProperty("y", org.iwidget.model.javascript.TextAreaElementJS.class, 0);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public void jsConstructor()
    {
        Scriptable scope = ScriptableObject.getTopLevelScope(this);
        Object obj = scope.get("widget", scope);
        elementData.widget = (WidgetElement)Context.toType(obj, org.iwidget.desktop.model.WidgetElement.class);
        setDefaults();
        elementData.widget.uiObjects.add(elementData);
        if(elementData.widget.getUIComponent() != null)
            elementData.widget.getUIComponent().insertTextAreaJS(elementData);
    }

    public String getAlignment()
    {
        return elementData.getAlignment();
    }

    public void setAlignment(String s)
    {
        elementData.setAlignment(s);
    }

    public String getBgColor()
    {
        return elementData.getBgColor();
    }

    public void setBgColor(String s)
    {
        elementData.setBgColor(s);
    }

    public int getBgOpacity()
    {
        return elementData.getBgOpacity();
    }

    public void setBgOpacity(int i)
    {
        elementData.setBgOpacity(i);
    }

    public String getColor()
    {
        return elementData.getColor();
    }

    public void setColor(String s)
    {
        elementData.setColor(s);
    }

    public String getCursor()
    {
        return elementData.getCursor();
    }

    public void setCursor(String string)
    {
        elementData.setCursor(string);
    }

    public String getData()
    {
        return elementData.getData();
    }

    public void setData(String string)
    {
        elementData.setData(string);
    }

    public boolean getEditable()
    {
        return elementData.getEditable();
    }

    public void setEditable(boolean b)
    {
        elementData.setEditable(b);
    }

    public String getFont()
    {
        return elementData.getFont();
    }

    public void setFont(String s)
    {
        elementData.setFont(s);
    }

    public int getHeight()
    {
        return elementData.getHeight();
    }

    public void setHeight(int i)
    {
        elementData.setHeight(i);
    }

    public boolean getHScrollbar()
    {
        return elementData.getHScrollbar();
    }

    public void setHScrollbar(boolean b)
    {
        elementData.setHScrollbar(b);
    }

    public String getName()
    {
        return elementData.getName();
    }

    public void setName(String s)
    {
        elementData.setName(s);
    }

    public int getOpacity()
    {
        return elementData.getOpacity();
    }

    public void setOpacity(int i)
    {
        elementData.setOpacity(i);
    }

    public Object getOwner()
    {
        return elementData.getOwner();
    }

    public void setOwner(Object o)
    {
        elementData.setOwner(o);
    }

    public int getSize()
    {
        return elementData.getSize();
    }

    public void setSize(int i)
    {
        elementData.setSize(i);
    }

    public String getStyle()
    {
        return elementData.getStyle();
    }

    public void setStyle(String s)
    {
        elementData.setStyle(s);
    }

    public String getTooltip()
    {
        return elementData.getTooltip();
    }

    public void setTooltip(String s)
    {
        elementData.setTooltip(s);
    }

    public boolean getVisible()
    {
        return elementData.getVisible();
    }

    public void setVisible(boolean b)
    {
        elementData.setVisible(b);
    }

    public boolean getVScrollbar()
    {
        return elementData.getVScrollbar();
    }

    public void setVScrollbar(boolean b)
    {
        elementData.setVScrollbar(b);
    }

    public int getWidth()
    {
        return elementData.getWidth();
    }

    public void setWidth(int i)
    {
        elementData.setWidth(i);
    }

    public int getX()
    {
        return elementData.getX();
    }

    public void setX(int i)
    {
        elementData.setX(i);
    }

    public int getY()
    {
        return elementData.getY();
    }

    public void setY(int i)
    {
        elementData.setY(i);
    }

    public void setOnMouseUp(String string)
    {
        elementData.setAction("onMouseUp", string);
    }

    public String getOnMouseUp()
    {
        return null;
    }

    public void setOnMouseDown(String string)
    {
        elementData.setAction("onMouseDown", string);
    }

    public String getOnMouseDown()
    {
        return null;
    }

    public void setOnMouseEnter(String string)
    {
        elementData.setAction("onMouseExit", string);
    }

    public String getOnMouseEnter()
    {
        return null;
    }

    public void setOnMouseExit(String string)
    {
        elementData.setAction("onMouseEnter", string);
    }

    public String getOnMouseExit()
    {
        return null;
    }

    public void setOnKeyDown(String string)
    {
        elementData.setAction("onKeyDown", string);
    }

    public String getOnKeyDown()
    {
        return null;
    }

    public void setOnKeyUp(String string)
    {
        elementData.setAction("onKeyUp", string);
    }

    public String getOnKeyUp()
    {
        return null;
    }

    public void setOnKeyPress(String string)
    {
        elementData.setAction("onKeyPress", string);
    }

    public String getOnKeyPress()
    {
        return null;
    }

    private static final long serialVersionUID = 0x2d34383239393432L;
    ElementTextArea elementData;
}